﻿<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="ObjectToOperate"></xsl:param>
  <xsl:template match="/DataSet">   public SqlParameter[] <xsl:value-of select="$ObjectToOperate"/>_Parameters(<xsl:for-each select="Table"><xsl:value-of select="DataType"/><xsl:text> </xsl:text><xsl:value-of select="Parameter"/><xsl:if test="position() != last()">,</xsl:if></xsl:for-each>)
    {
      <xsl:for-each select="Table">
      <xsl:choose><xsl:when test="ParameterType = 'nvarchar'">SqlParameter param<xsl:value-of select="Parameter"/> = DALHelper.SqlParameter("<xsl:value-of select="Parameter"/>", SqlDbType.<xsl:value-of select="ParameterType"/>, <xsl:value-of select="max_length"/>, <xsl:value-of select="Parameter"/>);
        </xsl:when>
      <xsl:otherwise>SqlParameter param<xsl:value-of select="Parameter"/> = DALHelper.SqlParameter("<xsl:value-of select="Parameter"/>", SqlDbType.<xsl:value-of select="ParameterType"/>, <xsl:value-of select="Parameter"/>);
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
    SqlParameter[] paramsList = new SqlParameter[] { <xsl:for-each select="Table">param<xsl:value-of select="Parameter"/><xsl:if test="position() != last()">, </xsl:if> </xsl:for-each> };
    return paramsList;
    }</xsl:template></xsl:stylesheet>